package com.nchu.netspace.server;

import java.io.InputStream;
import java.net.InetSocketAddress;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * 传统 同步阻塞IO网络编程
 * @author fujianjian
 * @project net-java-space
 * @date 2018/11/1 22:27
 */
public class BIOTCPServer {

    public static void main(String[] args) throws Exception {

        ServerSocket serverSocket = new ServerSocket();
        serverSocket.bind(new InetSocketAddress(8080));
        Socket clientSocket = serverSocket.accept();

        System.out.println("存在客户端连接服务器了。。。");
        InputStream in = clientSocket.getInputStream();
        while (true) {
            in.read();
        }

    }
}
